﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using MSBTC.Model;
using MSBTC.CrystalReport;

namespace MSBTC.ReportViewer
{
    public partial class ReqRptForm : Form
    {
        public ReqRptForm()
        {
            InitializeComponent();
        }

        private void crysReq_Load(object sender, EventArgs e)
        {
            Request rmod = new Request();
            ReqRpt req = new ReqRpt();

            TextObject txtobj;
            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txttot"];
            txtobj.Text = rmod.Cost();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtdate"];
            txtobj.Text = rmod.Date();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtsupp"];
            txtobj.Text = rmod.SuppOwner();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtAddr"];
            txtobj.Text = rmod.SuppAddr();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtSName"];
            txtobj.Text = rmod.SuppName() + ";";

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtMsg"];
            txtobj.Text = rmod.Message();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtorder"];
            txtobj.Text = rmod.OrderBy();

            #region Materials
            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtMat1"];
            txtobj.Text = rmod.Mat1();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtMat2"];
            txtobj.Text = rmod.Mat2();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtMat3"];
            txtobj.Text = rmod.Mat3();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtMat4"];
            txtobj.Text = rmod.Mat4();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtMat5"];
            txtobj.Text = rmod.Mat5();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtMat6"];
            txtobj.Text = rmod.Mat6();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtMat7"];
            txtobj.Text = rmod.Mat7();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtMat8"];
            txtobj.Text = rmod.Mat8();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtMat9"];
            txtobj.Text = rmod.Mat9();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtMat10"];
            txtobj.Text = rmod.Mat10();
            #endregion

            #region Quantity
            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtqty1"];
            txtobj.Text = rmod.Qty1();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtqty2"];
            txtobj.Text = rmod.Qty2();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtqty3"];
            txtobj.Text = rmod.Qty3();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtqty4"];
            txtobj.Text = rmod.Qty4();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtqty5"];
            txtobj.Text = rmod.Qty5();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtqty6"];
            txtobj.Text = rmod.Qty6();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtqty7"];
            txtobj.Text = rmod.Qty7();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtqty8"];
            txtobj.Text = rmod.Qty8();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtqty9"];
            txtobj.Text = rmod.Qty9();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtqty10"];
            txtobj.Text = rmod.Qty10();
            #endregion

            #region Unit Cost
            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtuc1"];
            txtobj.Text = rmod.UCt1();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtuc2"];
            txtobj.Text = rmod.UCt2();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtuc3"];
            txtobj.Text = rmod.UCt3();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtuc4"];
            txtobj.Text = rmod.UCt4();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtuc5"];
            txtobj.Text = rmod.UCt5();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtuc6"];
            txtobj.Text = rmod.UCt6();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtuc7"];
            txtobj.Text = rmod.UCt7();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtuc8"];
            txtobj.Text = rmod.UCt8();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtuc9"];
            txtobj.Text = rmod.UCt9();

            txtobj = (TextObject)req.ReportDefinition.ReportObjects["txtuc10"];
            txtobj.Text = rmod.UCt10();
            #endregion

            crysReq.ReportSource = req;
            crysReq.RefreshReport();
        }
    }
}
